package com.zmm.study.order.service;

import com.zmm.common.exception.handle.BusinessException;
import com.zmm.study.order.model.MoNiOrder;
import com.zmm.study.order.model.Order;
import com.zmm.study.order.ware.StockLockedTo;
import com.zmm.study.order.ware.WareSkuLockVo;

/**
 * @Description:
 * @Name OrderService
 * @Author Zebulon
 * @Date By 2021-07-21 23:16:11
 */
public interface OrderService {

    /**
     * 新增订单业务 -- 接口
     * @description:
     * @author: Zebulon
     * @date: 2021-07-21 23:16:45
     * @throws BusinessException
     * @param order: 
     * @return: boolean
     **/
    boolean addOrder(Order order) throws BusinessException;

    /**
     * 使用延迟队列 定时关闭订单
     * @author: 900045
     * @date: 2021-10-20 10:11:34
     * @throws 
     * @param moNiOrder: 
     * @return: void
     **/
	void closeOrder(MoNiOrder moNiOrder);
	
	/**
	 * 主动关闭订单
	 * @author: 900045
	 * @date: 2021-10-21 11:07:15
	 * @throws 
	 * @param orderNo: 
	 * @return: void
	 **/
	void closeOrder(String orderNo);

	/**
	 * 提交订单
	 * @author: 900045
	 * @date: 2021-10-20 11:14:14
	 * @throws 
	 * @param moNiOrder: 
	 * @return: void
	 **/
	void submitOrder(MoNiOrder moNiOrder);
	
	/**
	 * 下订单后锁定库存
	 * @author: 900045
	 * @date: 2021-10-20 16:17:28
	 * @throws 
	 * @param wareSkuLockVo: 
	 * @return: boolean
	 **/
	boolean orderLockStock(WareSkuLockVo wareSkuLockVo);


	/**
	 * 解锁库存
	 * @author: 900045
	 * @date: 2021-10-20 17:15:44
	 * @throws 
	 * @param to: 
	 * @return: void
	 **/
	void unLockStock(StockLockedTo to);
	
	
	/**
	 * 主动关闭订单 --> 主动解锁库存(部分解锁)
	 * @author: 900045
	 * @date: 2021-10-21 11:10:03
	 * @throws 
	 * @param orderNo: 
	 * @param skuId:
	 * @param skuNum:
	 * @param wareId:   
	 * @return: void
	 **/
	void unLockStock(String orderNo,Long skuId,Integer skuNum,Long wareId);

	/**
	 * 主动关闭订单 --> 主动解锁库存(全部解锁)
	 * @author: 900045
	 * @date: 2021-10-21 11:22:45
	 * @throws 
	 * @param orderNo: 
	 * @return: void
	 **/
	void unLockStock(String orderNo);

	/**
	 * 订单支付完成 ---> 改变订单状态为已支付
	 * @author: 900045
	 * @date: 2021-10-21 14:23:37
	 * @throws 
	 * @param orderNo: 
	 * @return: void
	 **/
	void finishOrder(String orderNo);

	/**
	 * 订单支付完成 ---> 真实扣减库存
	 * @author: 900045
	 * @date: 2021-10-21 14:26:02
	 * @throws 
	 * @param orderNo: 
	 * @return: void
	 **/
	void discountStock(String orderNo);
}
